// Copyright (C) 2020 Wuguyannian - All Rights Reserved

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "TapDBLibrary.generated.h"

/**
 * Blueprint interface
 */
UCLASS(meta = (ScriptName = "TapDBLibrary"))
class TAPDB_API UTapDBLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	
	/**
	* Record a user. Called when the user logs in
	*
	* @param UserId 
	*        The length is greater than 0 and less than or equal to 256. 
	*        Can only contain numbers, upper and lower case letters, underscore (_),
	*        horizontal line (-), user ID. Different users need to ensure the uniqueness of the ID
	*/
	UFUNCTION(BlueprintCallable, Category = "TapDB")
	static void SetUser(FString UserId);

	/**
	* Set the user name
	*
	* @param Name
	*        The length is greater than 0 and less than or equal to 256. username
	*/
	UFUNCTION(BlueprintCallable, Category = "TapDB")
	static void SetName(FString Name);

	/**
	* Set the user level. Called when the user logs in or upgrades
	*
	* @param Level
	*        greater than or equal to 0. user level
	*/
	UFUNCTION(BlueprintCallable, Category = "TapDB")
	static void SetLevel(int32 Level);

	/**
	* Set the server where the user is located. Called when the user logs in or switches servers
	*
	* @param Server
	*        The length is greater than 0 and less than or equal to 256. User's server
	*/
	UFUNCTION(BlueprintCallable, Category = "TapDB")
	static void SetServer(FString Server);

	/**
	* Called when the recharge is successful. 
	* Only one of SDK push and the server push method described in 4.1 can be selected. 
	* It is recommended to prefer the server-side push method to ensure data accuracy.
	*
	* @param OrderId
	*        length is greater than 0 and less than or equal to 256. Order ID. Pass the order ID can be rearranged to prevent multiple calculations
	* @param Product
	*		 length greater than 0 and less than or equal to 256. product name
	* @param amount
	*		 greater than 0 and less than or equal to 100000000000. 
	*		 Recharge amount. Unit points, that is, 
	*        no matter what currency, you need to multiply by 100
	* @param CurrencyType
	*		 Currency type. International three-letter notation, defaults to CNY when empty. 
	*		 Reference: Chinese Yuan CNY, US Dollar USD; Euro EUR
	* @param Payment
	*        length greater than 0 and less than or equal to 256. Recharge channel
	*/
	UFUNCTION(BlueprintCallable, Category = "TapDB")
	static void OnCharge(FString OrderId, FString Product, int32 amount, FString CurrencyType, FString Payment);

	/**
	* Push custom events. Need to be pre-configured in the console.
	*
	* @param EventCode
	*        The event code configured in the console
	* @param Properties
	*		 Event properties. It needs to match the console configuration. 
	*		 The value needs to be a string with a length greater than 0 and less than or equal to 256
	*/
	UFUNCTION(BlueprintCallable, Category = "TapDB")
	static void OnEvent(FString EventCode, FString Properties);
};
